package proc

import (
	"client/model"
	"common"
	"fmt"
)

var (
	onlineUser  = make(map[int]*common.User, 1024)
	curUser = model.CurUser{}
)

func ShowOnlineUsersInfo() {
	fmt.Println("在线用户列表：", len(onlineUser))
	for id,_ := range onlineUser {
		fmt.Print(id, "\t")
	}
}

func UpdateUserStatus(notifyUser *common.NotifyUser) {
	user, ok := onlineUser[notifyUser.Id]
	if !ok {
		user = &common.User{
			UserId: notifyUser.Id,
		}
	}
	user.UserStatus = notifyUser.Status
	onlineUser[user.UserId] = user
	fmt.Println("uid is ", user.UserId)
	ShowOnlineUsersInfo()
}
